import { ReqResponse } from '@/shims';
import axios from '@/utils/axios';
import Cacher from '@/utils/cache';

/**
 * 登录
 * @param data {username password}
 */
const login = (params: {}) => {
  const url = `/miniAuth/oauth/wechat/token`
  const begin = Cacher.instance.getData((data: {}) => {
    return axios.request<ReqResponse.Data>({
      url: url,
      method: 'POST',
      data,
      params: data,
    });
  });
  return begin(url, params)
};

login({ openId: '123456', nickname: '', headimgurl: '' }).then((res: any) => {
  console.log('我是返回的参数--', res.data.error_code);
});
